FROM registry.cn-hangzhou.aliyuncs.com/tan90/maven:3.8.5-openjdk-17-slim AS buildPhase
WORKDIR /build
COPY src ./src
COPY pom.xml .

RUN ["/bin/sh", "-c", "mvn clean package '-Dmaven.test.skip=true'"]
RUN ["/bin/sh", "-c", "cp target/*.jar app.jar"]

FROM registry.cn-hangzhou.aliyuncs.com/tan90/openjdk:17-slim

LABEL mainatiner="tan90" \
      company="江苏铁人科技有限公司" \
      address="南通市崇州大道60号南通创新区紫琅科技城13-A号楼602室"

WORKDIR /app

ENV JVM_OPT="-Duser.timezone=GMT+8 -Xms256m -Xmx256m"

COPY --from=buildPhase /build/app.jar app.jar

EXPOSE 8090

ENTRYPOINT ["/bin/sh", "-c", "java $JVM_OPT -jar app.jar"]